﻿namespace ObjectMapper.Benchmark
{
    public class AutoMapperExecutor : IMapExecutor
    {
        public string Name
        {
            get { return "AutoMapper"; }
        }

        public void Initialize()
        {
        }

        public void PreExecute<TSource, TTarget>()
        {
            AutoMapper.Mapper.CreateMap(typeof (TSource), typeof (TTarget));
        }

        public TTarget[] Execute<TSource, TTarget>(TSource[] entities)
        {
            return AutoMapper.Mapper.Map<TSource[], TTarget[]>(entities);
        }

        public void PostExecute<TSource, TTarget>()
        {
        }
    }
}